package com.sk.compiler.info.autowire;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class MethodInfo {

    private String methodName;
    private List<ParamInfo> paramInfos;
    private Set<String> packages;

    public MethodInfo(String methodName) {
        this.methodName = methodName;
        paramInfos=new ArrayList<>();
        packages=new HashSet<>();
    }

    public List<ParamInfo> getParamInfos() {
        return paramInfos;
    }

    public Set<String> getPackages() {
        return packages;
    }

    public String getMethodName() {
        return methodName;
    }

    public void addParamInfo(String key, String fullClass) {
        String clazz = addPackageAndGetName(fullClass);
        paramInfos.add(new ParamInfo(clazz,key));
    }

    private String addPackageAndGetName(String fullClass) {
        packages.add(fullClass);
        return fullClass.substring(fullClass.lastIndexOf('.')+1);
    }

}